﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@ Register Src="../Shared/Header.ascx" TagName="Header" TagPrefix="uc1" %>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
    <title>过期预警统计</title>
    <uc1:Header ID="Header1" runat="server" />
    <script type="text/javascript" language="javascript">
        $(function () {
            $('#grid').datagrid({
                iconCls: 'icon-save',
                nowrap: false,                      //数据是否显示在一行里
                striped: true,                      //奇偶行使用不同背景色
                url: '/Query/LoadIndex4/',           //从远程站点请求数据的 URL
                fitColumns: true,                   //适应表格的宽度并且防止水平滚动
                singleSelect: true,                //是否允许选中一行
                pagination: false,                  //分页
                rownumbers: true,                   //行号
                columns: [[
                     { field: 'name', title: '器械包有效期', width: 80,
                         formatter: function (value, rowData, rowIndex) {
                             return '<span style="font-size:10pt; font-weight:bolder;" >' + value + '</span>';
                         }
                     }
                    , { field: 'count', title: '库存数量(个)', width: 80,
                        formatter: function (value, rowData, rowIndex) {
                            //return '<span style="color:Red; font-size:14pt; font-weight:bolder;" >' + value + '</span>';
                            if (rowIndex == 0) {
                                return '<input type="button" style="color:Red;font-size:14pt; font-weight:bolder;" value="' + value + '" onclick="f1(1,' + value + ')" />';
                            }
                            else if (rowIndex == 1) {
                                return '<input type="button" style="color:Red;font-size:14pt; font-weight:bolder;" value="' + value + '" onclick="f2(1,' + value + ')" />';
                            }
                            else {
                                return '<input type="button" style="color:Red;font-size:14pt; font-weight:bolder;" value="' + value + '" onclick="f2(3,' + value + ')" />';
                            }
                        }
                    }
                    , { field: 'ncount', title: '未归还数量(个)', width: 80,
                        formatter: function (value, rowData, rowIndex) {
                            if (rowIndex == 0) {
                                return '<input type="button" style="color:Green;font-size:14pt; font-weight:bolder;" value="' + value + '" onclick="f1(2,' + value + ')" />';
                            }
                            else if (rowIndex == 1) {
                                return '<input type="button" style="color:Red;font-size:14pt; font-weight:bolder;" value="' + value + '" onclick="f2(2,' + value + ')" />';
                            }
                            else {
                                return '<input type="button" style="color:Red;font-size:14pt; font-weight:bolder;" value="' + value + '" onclick="f2(4,' + value + ')" />';
                            }
                        }
                    }
                    , { field: 'allcount', title: '总数(个)', width: 80,
                        formatter: function (value, rowData, rowIndex) {
                            return '<span style="color:Black; font-size:14pt; font-weight:bolder;" >' + value + '</span>';
                        }
                    }
                ]]
            });
        });


            function f1(spType, num) {
                if (num == 0) {
                    $.messager.alert('提示', '无过期包！');
                 }
                else {
                    var objId = "";
                    var sp_type = "";
                    var width = 950;
                    if (spType == 1) {
                        objId = "grid_inventorys1";
                        sp_type = "库存";
                    }
                    else {
                        objId = "grid_inventorys2";
                        sp_type = "未归还";
                    }

                    $('#win').dialog({
                        title: '过期包列表',
                        iconCls: 'icon-search',
                        width: width,
                        height: 500,
                        closed: false,
                        cache: false,
                        href: '/Query/Index5/',
                        modal: true,
                        resizable: true,
                        onLoad: function () {
                            $('#' + objId).datagrid({
                                iconCls: 'icon-save',
                                nowrap: true,                       //数据是否显示在一行里
                                striped: true,                      //奇偶行使用不同背景色
                                url: '/Query/LoadIndex5/' + spType, //从远程站点请求数据的 URL
                                fitColumns: true,                   //适应表格的宽度并且防止水平滚动
                                singleSelect: true,                 //是否允许选中一行
                                pagination: false,                  //分页
                                rownumbers: true,                   //行号
                                onLoadSuccess: function (data) {
                                    var totle = eval(data).total
                                    $("#sp_inventorys").text(totle);
                                    $("#sp_type").text(sp_type);
                                    $('#exportdate5').linkbutton({ disabled: false });
                                }
                            });
                            $("#north_inventorys").parent().css("overflow-y", "auto");

                        },
                        toolbar: [{
                            id: 'exportdate5',
                            text: '导出',
                            iconCls: 'icon-save',
                            disabled: true,
                            handler: function () {
                                var url = '/Query/ExportData5/' + spType;
                                var elemA = document.createElement("a");
                                elemA.href = url;
                                elemA.style.display = "none";
                                document.body.appendChild(elemA);
                                elemA.click();
                            }
                        }]
                    });
                }
            }

            function f2(spType, num) {
                if (num == 0) {
                    $.messager.alert('提示', '无预警包！');
                }
                else {
                    var objId = "";
                    var sp_type = "";
                    var width = 950;
                    if (spType == 1 || spType == 3) {
                        objId = "grid_noReturns1";
                        sp_type = "库存";
                    }
                    else {
                        objId = "grid_noReturns2";
                        sp_type = "未归还";
                    }

                    $('#win').dialog({
                        title: '预警包列表',
                        iconCls: 'icon-search',
                        width: width,
                        height: 500,
                        closed: false,
                        cache: false,
                        href: '/Query/Index6/',
                        modal: true,
                        resizable: true,
                        onLoad: function () {
                            $('#' + objId).datagrid({
                                iconCls: 'icon-save',
                                nowrap: true,                       //数据是否显示在一行里
                                striped: true,                      //奇偶行使用不同背景色
                                url: '/Query/LoadIndex6/' + spType, //从远程站点请求数据的 URL
                                fitColumns: true,                   //适应表格的宽度并且防止水平滚动
                                singleSelect: true,                 //是否允许选中一行
                                pagination: false,                  //分页
                                rownumbers: true,                   //行号
                                onLoadSuccess: function (data) {
                                    var totle = eval(data).total
                                    $("#sp_noReturns").text(totle);
                                    $("#sp_type").text(sp_type);
                                    $('#exportdate6').linkbutton({ disabled: false });
                                }
                            });
                            $("#north_inventorys").parent().css("overflow-y", "auto");

                        },
                        toolbar: [{
                            id: 'exportdate6',
                            text: '导出',
                            iconCls: 'icon-save',
                            disabled: true,
                            handler: function () {
                                var url = '/Query/ExportData6/' + spType;
                                var elemA = document.createElement("a");
                                elemA.href = url;
                                elemA.style.display = "none";
                                document.body.appendChild(elemA);
                                elemA.click();
                            }
                        }]
                    });
                }
            }        

    </script>
</head>
<body class="easyui-layout">  
    <div region="north" style="padding:5px;" border="false"> 
        <table style="width:100%; background-color:#EFEFEF; font-size:12px;line-height:1.5;" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td style="border-bottom:1px solid #CCCCCC;"><span style="padding-left:10px;">备注：</span></td>
            </tr>
            <tr>
                <td style="padding-left:10px;">过期预警统计主要包括过期统计和预警统计，当库存出现过期包时，须及时回收处理。
                </td>
            </tr>
            <tr>
                <td style="padding-left:10px;">有效期7天的器械包系统提前1天预警，有效期7天以上的系统提前3天预警，当系统发出预警信号时，尽快使用，以免过期造成浪费。
                </td>
            </tr>
        </table>                     
    </div>  
    <div region="center" style="padding:0 5px 5px 5px;" border="false">        
        <table id="grid">
        </table>
    </div>    
    <div id="win" /> 
    <div id="dlg-buttons">   
        <table cellpadding="0" cellspacing="0" style="width:100%">   
            <tr>   
                <td style="text-align:right">   
                    <a href="#" class="easyui-linkbutton" iconCls="icon-save" onclick="javascript:alert('save')">导出</a>   
                    <a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dd').dialog('close')">Close</a>   
                </td>   
            </tr>   
        </table>   
    </div> 
</body>
</html>
